<html lang="en">
	<head>
		<script type="text/javascript">
<?php if (isset($generated)): ?>
		var currentStep = 2;
<?php else: ?>
		var currentStep = 1;
<?php endif; ?>
			
		</script>
	</head>
	<body>
		<div class="grid_16 relative">
			<div id="step1" class="step">
				<form method="POST">
					<div id="" class="" style="">
						Please choose overriding type<br/>
						<select name="structureId" id="structureId">
							<?php foreach ($agencyStructures as $key => $value): ?>
								<option value="<?php echo $key; ?>">Dim <?php echo $value['noOfDimensions'] . ': ' . $value['name']; ?></option>
							<?php endforeach; ?>
						</select>
						<!--<a id="linkConfigureStructure" class="button"">Configure Overriding Structure</a>-->
						<button type="button" id="btnConfigureStructure">Configure Overriding Structure</button>
					</div><br>
					<div id="" class="" style="">
						Please select closing agent<br/>
						<select name="intAgentId">
							<?php foreach ($agentsAll as $key => $value): ?>
								<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
							<?php endforeach; ?>
						</select>
					</div><br>
					<div id="" class="" style="">
						Please enter co-broking share amount 
						$<input type="text" name="ttlCommAmount"><br/><br/>
						Please enter agent's percentage of co-broking share  
						<input type="text" name="sharePercent" size="3">% <br/>
						(eg 70%,75%,80%, etc)<br/>
					</div><br>

					<div id="designationId" class="" style="display:none;">
						Please select closing agent's designation<br/>
						<select name="designationId">
							<?php foreach ($agencyDesignations as $key => $value): ?>
								<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
							<?php endforeach; ?>
						</select>
					</div><br>
					<div class="row">
						<input type="submit" value="Submit" />
					</div>
				</form>
			</div>

			<div id="step2" class="step" style="display:none;">
				<h3>Summary for co-broking agent <?php echo strtoupper($agentsToReceiveNames[0]); ?>,</h3>
				<h3>for the co-broking share amount of $<?php echo number_format($ttlCommAmount, 2) ?></h3>
				<div id="table">
					<table>
						<tr>
							<th>Recipient</th><th>Name</th><th>Share Type</th><th>Share Qty</th><th>Dollar Amt to Receive</th>
						</tr>
						<?php if (isset($generated)): ?>
							<?php foreach ($agentsToReceive as $index => $id): ?>
								<?php
								if (empty($agentsToReceive[$index])) {
									break;
								}
								?>
								<tr>
									<td><?php echo ($index == 0 ? 'Co-broking Salesperson' : 'T' . $index); ?></td>
									<td><?php echo $agentsToReceiveNames[$index]; ?></td>
									<td><?php echo $overrideAmountTypes[$index]; ?></td>
									<td><?php echo $overrideAmounts[$index]; ?></td>
									<td>$<?php echo $overrideDollarAmounts[$index]; ?></td>
								</tr>
							<?php endforeach; ?>
						<?php endif; ?>
					</table>
					<?php
					if (empty($agentsToReceive[1])) {
						echo $agentsToReceiveNames[0] . ' is currently not assigned any overriding tiers.';
					}
					?>
					<div class="row">
						The balance amount to be received by agency is $<?php echo $amountDueToAgency ?>
					</div><br/>
					<div class="row">
						<button type="button" id="btnInputAnotherTrans">Input Another Transaction</button>
					</div>

				</div>
			</div>

		</div>
	</body>
</html>